// User.java
public abstract class User {
    protected String name;
    protected String userType;

    public User(String name, String userType) {
        this.name = name;
        this.userType = userType;
    }

    // 计算价格的抽象方法
    public abstract double calculatePrice(HotelRoom room);
}

// NormalUser.java
public class NormalUser extends User {
    public NormalUser(String name) {
        super(name, "Normal");
    }

    @Override
    public double calculatePrice(HotelRoom room) {
        // 普通用户没有折扣，直接返回房价
        return room.getPrice();
    }
}

// GoldCardUser.java
public class GoldCardUser extends User {
    public GoldCardUser(String name) {
        super(name, "Gold");
    }

    @Override
    public double calculatePrice(HotelRoom room) {
        // 金卡用户享受8折
        return room.getPrice() * 0.8;
    }
}

// SilverCardUser.java
public class SilverCardUser extends User {
    public SilverCardUser(String name) {
        super(name, "Silver");
    }

    @Override
    public double calculatePrice(HotelRoom room) {
        // 银卡用户享受9折
        return room.getPrice() * 0.9;
    }
}

// HotelRoom.java
public class HotelRoom {
    private String roomType;
    private double basePrice;

    public HotelRoom(String roomType, double basePrice) {
        this.roomType = roomType;
        this.basePrice = basePrice;
    }

    public double getPrice() {
        return basePrice;
    }
}

// BookingSystem.java
public class BookingSystem {
    // 通过用户类型计算房价
    public double makeBooking(HotelRoom room, User user) {
        // 根据用户类型调用 calculatePrice 方法
        return user.calculatePrice(room);
    }
}

// Main.java
public class Main {
    public static void main(String[] args) {
        // 创建一个房间，基础房价500
        HotelRoom room = new HotelRoom("Deluxe", 500);

        // 创建不同类型的用户
        User normalUser = new NormalUser("Alice");
        User goldUser = new GoldCardUser("Bob");
        User silverUser = new SilverCardUser("Charlie");

        // 创建预订系统
        BookingSystem bookingSystem = new BookingSystem();

        // 计算并打印每种用户的房价
        System.out.println("Normal User Price: " + bookingSystem.makeBooking(room, normalUser)); // 500
        System.out.println("Gold Card User Price: " + bookingSystem.makeBooking(room, goldUser)); // 400
        System.out.println("Silver Card User Price: " + bookingSystem.makeBooking(room, silverUser)); // 450
    }
}
